package com.ll.controller;


import com.ll.pojo.VO.StudentVO;
import com.ll.service.StudentService;
import com.ll.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/stu")
public class StudentController {

    @Autowired
    private StudentService service;
    @GetMapping("/class")
    public Result findAllStudentAndClassroom(){
        List<StudentVO> list = service.findAllStudentAndClassroom( );
        return Result.success( list);
    }

    @GetMapping("/subjects")
    public Result findStudentAndAllSubjectByStuid(int sid){
        StudentVO studentVO = service.findStudentAndAllSubjectByStuid(sid);
        return Result.success(studentVO);
    }

    @GetMapping("/subjects/teacher")
    public Result findStudentAndAllSubjectAndTeacherByStuid(int sid){
        StudentVO studentVO = service.findStudentAndAllSubjectAndTeacherByStuid(sid);
        return Result.success(studentVO);
    }
}
